(print 
 (loop for i in 
      (mapcar #'parse-integer 
	      (mapcar #'string 
		      (loop for char across 
			   (write-to-string (expt 2 1000)) 
			 collect char))) 
    sum i))
	
(require 'memoization)

(defun count-sq( i j )
  ;; n+1 -> 2 ( 1 + 1Tn + 2Tn + ... + nTn)
  ;; (i j) -> (i-1, j) + (i-1, j-1) + (i-1, j-2) + ... + (i-1, 0)
  (cond ((or (zerop i) (zerop j)) 1)
	(t (loop for k from j downto 0 sum (count-sq (1- i) (- j k))))))

(memoization:MEMOIZE-FUNCTIONS '(count-sq))

(defun probl15()
  (count-sq 20 20))